import React from "react";
import {Button, Grid} from "@material-ui/core";
import {ArchiveRounded, CloudDownloadRounded, FileCopyRounded, FindInPageRounded, MapRounded} from "@material-ui/icons";

import {EnhancedTable, Toolbar} from "../../../shared/components"
import {renderEditDeleteActions} from "../../../shared/utilities/uiTemplate.util";

const InspectionReport = (props) => {

    return (
        <Grid container spacing={4}>
            <Toolbar
                title="Inspection History"
                actions={<React.Fragment>
                    <Button variant="contained" color="primary" startIcon={<FindInPageRounded/>}>Start New
                        Inspection</Button>
                    <Button variant="contained" color="default" startIcon={<MapRounded/>}>Map View</Button>
                </React.Fragment>}
            />

            <Grid item xs={12}>
                <EnhancedTable
                    title={"Inspection List"}
                    schema={[
                        {id: 'id', label: 'Id', hidden: true},
                        {id: 'reportNum', label: 'Report No.', sort: true},
                        {id: 'date', label: 'Date', sort: true},
                        {id: 'vehicle', label: 'Vehicle', sort: true},
                        {id: 'location', label: 'Location', sort: true},
                        {id: 'inspector', label: 'Inspector', sort: true},
                        {id: 'fault', label: 'Fault', sort: true},
                        {id: 'correctiveAction', label: 'Corrective Action', sort: true},
                        {id: 'linkedWO', label: 'Linked WO', sort: true},
                        {id: 'actions', label: 'Actions', type: 'render', render: renderEditDeleteActions},
                    ]}
                    data={[]}
                    selection
                    pagination={false}
                    actions={[
                        {id: "archive", tooltip: "Archive Inspection", icon: ArchiveRounded},
                        {id: "downloadExcel", tooltip: "Download Excel", icon: CloudDownloadRounded},
                        {id: "allReport", tooltip: "All Report", icon: FileCopyRounded}
                    ]}
                />
            </Grid>
        </Grid>
    );
};

export default InspectionReport;
